using System.Linq;
using Comdiv.Application;
using Comdiv.Conversations;
using Comdiv.Extensions;
using Comdiv.Inversion;
using Comdiv.IO;
using Comdiv.Logging;
using Comdiv.Model;
using Comdiv.Model.Interfaces;
using Comdiv.Persistence;
using Comdiv.Rules.Context;
using Comdiv.Security;
using Comdiv.Security.Acl;

namespace Comdiv.Rules.Tests{
    public class EXECM : ExecModule{
        private string paramName = "p1";
        private bool passed;
        private object value = 1;
        public EXECM() {}

        public EXECM(string paramName, object value){
            ParamName = paramName;
            Value = value;
        }

        public bool Passed{
            get { return passed; }
            set { passed = value; }
        }

        public string ParamName{
            get { return paramName; }
            set { paramName = value; }
        }

        public object Value{
            get { return value; }
            set { this.value = value; }
        }

        public override void Execute(IRuleContext context){
            Passed = true;
            context.RuleData[this.Target, "fired"] = true;
            context.Params[ParamName] = Value;
        }
    }
}